/*
struct TreeNode {
	int val;
	struct TreeNode *left;
	struct TreeNode *right;
	TreeNode(int x) :
			val(x), left(NULL), right(NULL) {
	}
};*/
class Solution {
public:
    vector<vector<int> > FindPath(TreeNode* root,int expectNumber) {
    	vector<int> path;
    	if(root != nullptr)
    		findPath(root,expectNumber,path,0);
    	return output;
    }

    void findPath(TreeNode *root , int expectNumber, vector<int> &path, int sum)
    {
        path.push_back(root->val);
        sum += root->val;
        bool isLeaf = (root->left==nullptr && root->right == nullptr);
        if(isLeaf && sum == expectNumber)
            output.push_back(path);
        if(root->left != nullptr)
            findPath(root->left,expectNumber,path,sum);
        if(root->right != nullptr)
            findPath(root->right,expectNumber,path,sum);
        path.pop_back();
    }
private:
    vector<vector<int>> output;
};